package com.pangzhao.bytebit;

/**
 * 中文对应的字节
 */
public class ChToByteBit {
    public static void main(String[] args) throws Exception {
// 中文在GBK编码下, 占据2个字节
// 中文在UTF-8编码下, 占据3个字节
        String a = "尚";
        byte[] bytes = a.getBytes();
        //byte[] bytes = a.getBytes("GBK");
        // byte[] bytes = a.getBytes("UTF-8");
        for (byte b : bytes) {
            System.out.print(b + "   ");
            String s = Integer.toBinaryString(b);
            System.out.println(s);
        }
    }
}
